import { SET_LANGUAGE } from './types';

// 定义语言状态的类型
export interface LanguageState {
  currentLanguage: string;
}

// 定义初始状态
const initialState: LanguageState = {
  currentLanguage: 'en', // 默认使用中文
};

// 定义语言reducer
const languageReducer = (state = initialState, action: any): LanguageState => {
  switch (action.type) {
    case SET_LANGUAGE:
      return {
        ...state,
        currentLanguage: action.payload,
      };
    default:
      return state;
  }
};

export default languageReducer; 